const Koa = require('koa');
const Router = require('koa-router');
const bodyParser = require('koa-body');
const views = require('koa-views');

const app = new Koa();
const router = new Router();

// 设置Pug视图引擎
app.use(views(__dirname + '/views', { extension: 'pug' }));

// 使用co-body解析请求体
app.use(bodyParser());

// 路由配置示例
router.get('/', async ctx => {
    ctx.render('index');
});

router.post('/login', async ctx => {
    // 登录逻辑
});

// 更多路由...

app.use(router.routes()).use(router.allowedMethods());

// 启动服务器
app.listen(3000, () => {
    console.log('Server running on port 3000');
});
